package com.zhb.designmode.creationmode.prototype.shallow;

public class Person implements Cloneable{
    private String name;
    private Integer age;

    public Person(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person p = (Person) super.clone();//如果不实现clonable接口，会抛出CloneNotSupportException
        return p;
    }
}
